const { Controller } = require('egg')

class HomeController extends Controller {
  // 获取tabbar
  async getTabbarList() {
    const { ctx, app } = this

    ctx.validate({
      type: { type: 'string', required: true }
    })
    const { type } = ctx.request.query

    const res = await app.model.Tags.findAll({
      where: {
        type
      }
    })

    if (res.length === 0) {
      return ctx.apiFail('系统故障')
    }
    return ctx.apiSuccess(res)
  }
}

module.exports = HomeController
